package com.woniuxy.pxxt.common.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO: 对应pxxt_list的list_format 表示这个资源是什么类型的
 *          表示资源的格式(1:图片,2:视频,3:word之类)
 * <P> Date: 2022/3/17:13:36
 * <P> Description:
 */

public enum ListFormatStatusEnum {
    IS_IMG("图片", 1),
    IS_VIDEO("视频", 2),
    IS_FILE("word之类", 3),
    ;

    private String name;
    private Integer urlType;

    ListFormatStatusEnum(String name, Integer urlType) {
        this.name = name;
        this.urlType = urlType;
    }

    public static String getStatusNameByStatus(Integer status) {
        ListFormatStatusEnum arrObj[] = ListFormatStatusEnum.values();
        for (ListFormatStatusEnum obj : arrObj) {
            if (status.intValue() == obj.getUrlType().intValue()) {
                return obj.getName();
            }
        }
        return "";
    }
    public static Integer getStatusInteger(String  name) {
        ListFormatStatusEnum arrObj[] = ListFormatStatusEnum.values();

        for (ListFormatStatusEnum obj : arrObj) {
            if (name.equals(obj.name) ) {
                return obj.getUrlType();
            }
        }
        return null;
    }


    public static List<Map<String,Object>> getStatusList() {
        List<Map<String,Object>> list = new ArrayList<>();

        ListFormatStatusEnum arrObj[] = ListFormatStatusEnum.values();

        for (ListFormatStatusEnum obj : arrObj) {
            Map<String,Object> map = new HashMap<>();
            map.put("status", obj.getUrlType());
            map.put("comment", obj.getName());
            list.add(map);
        }
        return list;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getUrlType() {
        return urlType;
    }

    public void setUrlType(Integer urlType) {
        this.urlType = urlType;
    }
}
